#pragma once

// class declarations
class CogParameters;

// -----

#include "CogObjective.h"

// ------------------------------------------------------------------------------------------
typedef uint32_t CogBuildMode;
const CogBuildMode COGBM_PARENTAL = 0x00000001;
const CogBuildMode COGBM_CONTINUOUS = 0x00000002;
const CogBuildMode COGBM_BIGSTART = 0x00000010;

typedef uint32_t CogGroupMode;
const CogGroupMode COGGM_NONE = 0x00000000;
const CogGroupMode COGGM_NOVELTY_LOCAL = 0x00000010;
const CogGroupMode COGGM_NOVELTY_ELEVATED = 0x00000020;

typedef uint32_t CogStopCondition;
const CogStopCondition COGSC_NONE = 0x00000000;
const CogStopCondition COGSC_PRIMARYZERO = 0x00000001;

#define OBJECTIVE_RANK_MAX 100

// -----

class CogParameters
{
public:
	CogParameters() { reset(); }
	~CogParameters() { objectives.clear(); }

	bool assign(const string& label, const string& value);
	CogEvaluator* assignObjective(const string& label, const string& value, uint32_t rank);
	CogEvaluator* assignObjective(const string& label, const string& objlabel, const string& objparam, uint32_t rank);
	bool convertToBool(const string& label, const string& value, bool& convert);
	bool convertChoice(const string& label, const string& value, uint32_t& convert, const map<string, uint32_t>& options);
	bool convertToInt(const string& label, const string& value, uint32_t& convert);
	bool convertToFloat(const string& label, const string& value, double& convert);
	void reset();
	void toStream(ostream &out);
	bool fromStream(istream &in);

	// data:
	CogBuildMode buildMode;
	size_t elitePop;
	size_t evalThreads;
	CogGroupMode groupMode;
	size_t maxEpochs;
	size_t maxPop;
	CogMultiObjective objectives;
	double probDrawFromTemplate;
	double probReuseOnCreate;
	uint32_t randomSeed;
	size_t sizeLimit;
	CogStopCondition stopCondition;
	size_t tourSize;
	size_t verbosity;

	string buildModeString;
	string cacheModeString;
	string groupModeString;
	string stopConditionString;
	string verbosityString;
};

// ------------------------------------------------------------------------------------------